package com.pickup.service;

import com.aliyuncs.exceptions.ClientException;
import com.pickup.netty.message.ChatMessage;
import com.pickup.netty.message.GroupMessage;
import com.pickup.pojo.Users;
import com.pickup.req.bo.UsersBO;
import com.pickup.req.vo.FriendRequestVO;
import com.pickup.req.vo.MyFriendsVO;
import com.pickup.req.vo.SmsCodeVo;
import com.pickup.resp.JSONResult;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;

public interface UserService {



    // 判断用户名是否存在
    public boolean queryUsernameIsExist(String username);

    // 判断手机号码是否存在
    public JSONResult queryCellPhoneIsExist(Users user) throws ClientException, ExecutionException, InterruptedException;

    // 用户登录
    public JSONResult queryUserForLogin(String keyword, String password) throws Exception;

    // 用户注册
    public JSONResult saveUser(SmsCodeVo smsCodeVo) throws Exception;

    // 获取验证码
    public JSONResult getCode(Users user) throws ClientException, ExecutionException, InterruptedException;

    // 修改头像
    public JSONResult updateUserInfo(UsersBO userBO) throws Exception;

    // 修改昵称
    public JSONResult updateUserNickname(UsersBO userBO);

    // 搜索朋友的前置条件
    public JSONResult preconditionSearchFriends(String myUserId, String friendKeyword);

    // 根据用户名/手机号码查询用户对象
    public Users queryUserInfoByUsername(String friendKeyWord);

    // 添加好友请求记录，保存到数据库
    public void sendFriendRequest(String myUserId, String friendUsername);

    // 查询好友请求
    public List<FriendRequestVO> queryFriendRequestList(String acceptUserId);

    // 删除好友请求记录
    public void deleteFriendRequest(String sendUserId, String acceptUserId);

    /**
     * 通过好友请求
     * 1. 保存好友
     * 2. 逆向保存好友
     * 3. 删除好友请求记录
     */
    public void passFriendRequest(String sendUserId, String acceptUserId);

    // 查询好友列表
    public List<MyFriendsVO> queryMyFriends(String userId);

    // 保存聊天消息到数据库
    public String saveMsg(ChatMessage chatMsg, String signType);

    // 保存聊天消息到数据库
    public String saveGroupMsg(ChatMessage chatMsg, String signType, String singleI);

    // 批量签收消息
    public void updateMsgSigned(List<String> msgIdList);

    // 获取未签收消息列表
    public List<com.pickup.pojo.ChatMsg> getUnReadMsgList(String userId);

    // 重制密码
    public JSONResult resetPassword(Users users);

    // 更新数据CID
    public Boolean updateCid(ArrayList<Users> users);

    // 绑定手机号码
    public JSONResult bindMobile(SmsCodeVo smsCodeVo);


    void getUnReadMsgGroupList(String userId);
}
